package com.ruoyi.system.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.domain.vo.HomeBarVo;
import com.ruoyi.system.domain.vo.HomeCountVo;
import com.ruoyi.system.service.IEmPropertiesService;
import java.math.BigDecimal;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author endless
 * @date 2024年10月28日 13:05
 * @description believe in yourself
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/system/home")
public class HomeController {
    private final IEmPropertiesService iEmPropertiesService;


    /**
     * 获取所有纯数字统计数据
     * @return {@link Object }
     */
    @SaCheckPermission("system:home:data")
    @GetMapping("getCount")
    public Object getCount(){
        HomeCountVo vo = iEmPropertiesService.getCount();
        return R.ok(vo);
    }


    /**
     * 获取资产状态图（饼图）
     * @return {@link Object }
     */
    @SaCheckPermission("system:home:data")
    @GetMapping("getStatusBar")
    public Object getStatusBar(){
        List<HomeBarVo> barVoList = iEmPropertiesService.getStatusBar();
        return R.ok(barVoList);
    }

    /**
     * 获取自有-资产面积图（饼图）
     * @return {@link Object }
     */
    @SaCheckPermission("system:home:data")
    @GetMapping("getStatusBar2")
    public Object getStatusBar2(){
        List<HomeBarVo> barVoList = iEmPropertiesService.getStatusBar2();
        return R.ok(barVoList);
    }

    /**
     * 获取代管-资产面积图（饼图）
     * @return {@link Object }
     */
    @SaCheckPermission("system:home:data")
    @GetMapping("getStatusBar3")
    public Object getStatusBar3(){
        List<HomeBarVo> barVoList = iEmPropertiesService.getStatusBar3();
        return R.ok(barVoList);
    }


    /**
     * 资产应收图（折线图）
     */
    @SaCheckPermission("system:home:data")
    @GetMapping("getReceivable")
    public Object getReceivable(){
        List<List<BigDecimal>> barVoList = iEmPropertiesService.getReceivable();
        return R.ok(barVoList);
    }




    /**
     * 租户数量变化图（柱状图）
     */
    @SaCheckPermission("system:home:data")
    @GetMapping("getChange")
    public Object getChange(){
        List<Integer> barVoList = iEmPropertiesService.getChange();
        return R.ok(barVoList);
    }


    /**
     * 资产数量变化图（柱状图）
     */
    @SaCheckPermission("system:home:data")
    @GetMapping("getChange2")
    public Object getChange2(){
        List<Integer> barVoList = iEmPropertiesService.getChange2();
        return R.ok(barVoList);
    }


}
